<?
require("config.php");

$location_status .= "| Add";
$show_backnav = "menu";
$menutype = 2;

if (NULL!=$action){

   $field = array(
	"code",
	"trainer",
	"date",
	"name",
	"details",
	"picture1",
	"picture2",
	"picture3",
	"picture4",
    "status",
	"publish_date",
	);


   $content = array(
	$Code,
	$Trainer,
	"$Year-$Month-$Day",
	$Name,
	$Details,
	$Picture1_name,
	$Picture2_name,
	$Picture3_name,
	$Picture4_name,
	$Status,
	"$myYear-$myMonth-$myDay",
	);

   myInsert($table,$field,$content);

   $dir = "$table/";

	myUpload($Picture1,$Picture1_name,$dir);

	myUpload($Picture2,$Picture2_name,$dir);

	myUpload($Picture3,$Picture3_name,$dir);

	myUpload($Picture4,$Picture4_name,$dir);


   header("location:" . $rela_path . "share/msg.php?v=7212&label=$Trainer");

   exit();

}

if (checkCode($table,$Code)){

	header("location:" . $rela_path . "share/msg.php?v=9001");
	exit();
}


require($rela_path . "inc/header.php");
require($rela_path . "bin/date.php");
require($rela_path . "bin/country.php");
?> 
<form action="" method="post" enctype="multipart/form-data" name="form1">
<!--hidden filed-->
<input name="action" type="hidden" value="add">
<input name="Code" type="hidden" value="<?print($Code)?>">

<input name="bk_Picture_sm" type="hidden" value="<?print($Picture_sm)?>">
<input name="bk_Picture" type="hidden" value="<?print($Picture)?>">

  <table width="95%" border="0" align="center">
    <tr> 
      <td align="right"> <input name="image" type="image" onclick="Redirect('menu.php?label=<?=$label?>',1);return false;" src="../../images/bt_cancel.gif" width="78" height="23"> 
        <input name="image" type="image" src="../../images/bt_save.gif" width="76" height="22"  <?print($active)?>> 
      </td>
    </tr>
  </table>
  <table width="95%" border="0" align="center">
    <tr> 
      <td align="right">&nbsp; </td>
    </tr>
    <tr> 
      <td><table border="0">



          <tr> 
            <td class="tdheader">Trainer :</td>
            <td>
			
<?
/*
if ($label){

	echo $label;
	echo "<input type=\"hidden\" name=\"Trainer\" value=\"$label\">";

}else{
*/
$Query = "select name from course_trainer_info";
$r = myQuery($Query);

$sourceData = array();

for ($i=0;$i<count($r);$i++){

	array_push($sourceData,$r[$i][0]);

	}


FFPSelectBox("Trainer",$value,$sourceData,$sourceLabel);
//}
?>  			
			
            </td>
          </tr>


          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>



          <tr> 
            <td class="tdheader">Code :</td>
            <td> <?print($Code)?>  </td>
          </tr>

          <tr> 
            <td class="tdheader">Date :</td>
            <td> <?=FFPdate(date("Y-m-d"))?> 
            </td>
          </tr>

          <tr> 
            <td class="tdheader">Title :</td>
            <td> <textarea class="text" name="Name" cols="60" rows="6"></textarea>
            </td>
          </tr>








          <tr> 
            <td class="tdheader">Details : </td>
            <td><textarea class="text" name="Details" cols="60" rows="20"></textarea></td>
          </tr>
          <tr> 
            <td class="tdheader">Picture 1:</td>
            <td><input type="file" class="text" name="Picture1" size="45"> </td>
          </tr>
          <tr> 
            <td class="tdheader">Picture 2 :</td>
            <td><input name="Picture2" type="file" class="text" size="45"></td>
          </tr>

          <tr> 
            <td class="tdheader">Picture 3 :</td>
            <td><input name="Picture3" type="file" class="text" size="45"></td>
          </tr>

          <tr> 
            <td class="tdheader">Picture 4 :</td>
            <td><input name="Picture4" type="file" class="text" size="45"></td>
          </tr>














		<tr> 
            <td class="tdheader">Publish :</td>
            <td> 
              <?

$sourceData = array(
  "Yes",
  "No",
  );

$boxName="Status";

$value=$Status;

FFPCheckBox("Status",$Status,$sourceData,$sourceLabel);

?>
          </tr>



          <tr> 
            <td class="tdheader">Publishing Date : </td>
            <td><?print(FFPtime(date("Y-m-d H:i")))?></td>
          </tr>











          <tr> 
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
    </tr>
  </table>
  <table width="95%" border="0" align="center">
    <tr> 
      <td align="right"> <input name="image2" type="image" onclick="Redirect('menu.php?label=<?=$label?>',1);return false;" src="../../images/bt_cancel.gif" width="78" height="23"> 
        <input name="image2" type="image" src="../../images/bt_save.gif" width="76" height="22" <?print($active)?>> 
      </td>
    </tr>
  </table>
</form>
<?
require($rela_path . "inc/footer.php");
?>

